  //获取应用实例
let app = getApp();
Page({
	data: {
		menuList: [
			{
				image: 'carDelay@2x.png',
				title: '粤港澳直通车',
				explain: '指标延期',
				url: '../fillInForm/fillInForm'
			}, {
				image: 'carDriver@2x.png',
				title: '粤港澳直通车',
				explain: '副驾驶变更',
				url: ''
			}, {
				image: 'carAddress@2x.png',
				title: '粤港澳直通车',
				explain: '邮寄地址录入',
				url: ''
			}
		],
    	isCanScroll: true, //屏幕是否能够滑动
		isShowFootNav: true,  //底部导航菜单
		num: 0  //订单数
	},	

	jumpUrl(e) {
		let url = e.currentTarget.dataset.url;
		if (url) {
			app.navigateTo({
				url: url
			})
		} else {
			wx.showToast({
				title: '正在努力开发中，敬请期待',
				icon: 'none',
				duration: 2000
			});
		}
	},

	//分享功能
	onShareAppMessage() {
		return {
			title: '粤港澳直通车',
			desc: '粤港澳直通车',
			path: '/pages/handle/handle'
		}
	},

	getOptionsParam(options) {
		app.globalData.channelId = decodeURIComponent(options.scene) != 'undefined'?
								decodeURIComponent(options.scene) : app.globalData.channelId ? 
								app.globalData.channelId:'';
			console.log("channelId",app.globalData.channelId);	
	},

	onLoad(options) {
		let that = this;
		app.getOpenIdRender((num,openId) => {
			that.getOptionsParam(options); //获取扫码参数
		})
	},

	onShow() {
		let that = this;
		app.getOrderNum((num,openId) => {
			that.setData({
				num: num
			})
		})
	},
	
	//底部切换页面方法
	toUrl(e) {
		let url = e.currentTarget.dataset.url;
		if(url!='/pages/handle/handle') { //点击不是当前页面
			if (url == '') {
				//develop（开发版），trial（体验版），release（正式版）
				let res = {
					appid: app.globalData.appid,
					path: '',
					envVersion: app.globalData.envVersion
				}
				app.crossToUrl(res)
			} else {
				app.redirectTo({url: url})
			}
		}
	},
	onHide() {
	},
	onUnload() {
	},
});
